package com.sw.paisong.controller;

import javax.servlet.http.HttpServletRequest;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.sw.paisong.util.SessionUtil;
import com.sw.paisong.vo.SessionVO;

@Controller
public class IndexController {

	private static final Logger logger = LoggerFactory.getLogger(IndexController.class);

	@RequestMapping(value = { "/", "/index" }, method = RequestMethod.GET)
	public String index(HttpServletRequest request) {
		SessionVO session = SessionUtil.getCurrentSession();
		if (session != null) {
			request.setAttribute("session", session);
			return "index";
		} else {
			return "redirect:login";
		}

	}
}
